<?php if(!defined('IN_FIRADIO')) {header('HTTP/1.1 403 Forbidden');exit('<h1>Access Denied</h1>');}?>
<?php $GLOBALS['script'][] = function() {?><script>
const fields = {};
fields.purpose = {"title":"主机用途","placeholder":"主机用途"};
fields.nickname = {"title":"客户昵称","placeholder":"客户中文名"};
fields.qquin = {"title":"QQ号码","placeholder":"QQ号码"};
fields.wechat = {"title":"微信号","placeholder":"微信号"};
fields.cellphone = {"title":"手机号码","placeholder":"手机号码"};
fields.payinfo = {"title":"付款信息","placeholder":"付款信息"};
vue.data.userdata_fields = fields;
vue.methods.submit_userjson = function () {
    vue.data.disabled++;
    const form = window.clone(vue.data.form);
    for (var name in form.userjson) {
        const attr = form.userjson[name];
        delete attr.placeholder;
    }
    this.ApiPost('/panel/yun/nthost/userjson.php', form).then(function (res) {
        vue.data.form.userjson = res.data.userjson;
    }, function (res) {
        console.log('reject:', res);
    }).catch(function (reason) {
        console.log('catch:', reason);
    }).then(function () {
        vue.data.disabled--;
    });
};
</script><?php }?>
<form class="form-horizontal" action="" method="post" v-on:submit="submit_userjson()" onsubmit="return false;">
    <div class="box-body">
        <div class="form-group" v-for="(attr,name) in form.userjson">
            <label for="qquin" class="col-sm-3 control-label">{{attr.title}}</label>
            <div class="col-sm-9">
                <input type="text" class="form-control"
                :id="name"
                v-model="attr.value"
                :disabled="disabled>0"
                :placeholder="attr.placeholder" />
            </div>
        </div>
    </div>
    <div class="box-body">
        <div class="box-footer col-sm-6 col-xs-12">
            <button type="submit" class="btn btn-info btn-block btn-flat" :disabled="disabled>0">保存</button>
        </div>
        <div class="box-footer col-sm-6 col-xs-12">
            <button type="button" class="btn btn-default btn-block btn-flat" v-on:click="tabclick('info')">返回详情</button>
        </div>
    </div>
</form>
